package cn.fastoo.web.backstage.web.controller.system;

import cn.fastoo.common.dao.system.AdminSystemMsgDao;
import cn.fastoo.common.dao.system.AdminSystemOrganizationDao;
import cn.fastoo.common.entity.system.AdminSystemMsg;
import cn.fastoo.common.entity.system.AdminSystemOrganization;
import cn.fastoo.common.sampleframe.dto.JsonResult;
import cn.fastoo.common.sampleframe.search.QuerySearch;
import cn.fastoo.common.sampleframe.search.Search;
import cn.fastoo.web.backstage.service.system.SystemService;
import cn.fastoo.web.backstage.utils.ShiroUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 用户页面 控制器.
 */
@Controller
@RequestMapping("/system/msg")
public class AdminSystemMsgController {
	private static Logger logger = LoggerFactory.getLogger(AdminSystemMsgController.class);

	@Autowired
	private AdminSystemMsgDao dao;

	@RequestMapping
	public String index() {
		return "/system/msg/index";
	}

	@RequestMapping("/manager")
	@ResponseBody
	public String manager(QuerySearch querySearch) {
		Search search = querySearch.getSearch().addSearchFilter("EQ_adminUserId",ShiroUtils.getUserId());
		search.addSort(new Sort(Sort.Direction.DESC,"id"));
		return JsonResult.querySearchSuccess(dao.findPage(search),querySearch);
	}



}
